package com.en.sharing.immutable;

import java.util.Date;

/**
 * 订单信息模型
 *
 * @author 付晓飞
 * @date 2024/3/12 6:58 下午
 */
public final class Order {

    /**
     * 申请编号
     */
    private final String lendApplyNo;
    /**
     * 用户编号
     */
    private final String uid;

    /**
     * 业务主键
     */
    private final String bizSerial;

    /**
     * 根业务主键
     */
    private final String parentBizSerial;
    /**
     * 核心订单号
     */
    private final String orderNo;
    /**
     * 业务类型：余额代偿，借现金
     */
    private final String bizType;
    /**
     * 借款类型：预借款，借款
     */
    private final String lendType;
    /**
     * 借款卡编号
     */
    private final String lendCardId;
    /**
     * 还款卡编号
     */
    private final String repayCardId;
    /**
     * 放款资方产品
     */
    private final String assetProductId;
    /**
     * 放款方
     */
    private final String assetBank;
    /**
     * 分期数
     */
    private final Integer stage;

    /**
     * 放款金额
     */
    private final Integer lendAmount;

    /**
     * 申请时间
     */
    private final Date applyTime;

    /**
     * 申请状态
     */
    private String applyStatus = "init";

    public Order(String lendApplyNo, String uid, String bizSerial, String parentBizSerial, String orderNo, String bizType, String lendType, String lendCardId, String repayCardId, String assetProductId, String assetBank, Integer stage, Integer lendAmount, Date applyTime) {
        this.lendApplyNo = lendApplyNo;
        this.uid = uid;
        this.bizSerial = bizSerial;
        this.parentBizSerial = parentBizSerial;
        this.orderNo = orderNo;
        this.bizType = bizType;
        this.lendType = lendType;
        this.lendCardId = lendCardId;
        this.repayCardId = repayCardId;
        this.assetProductId = assetProductId;
        this.assetBank = assetBank;
        this.stage = stage;
        this.lendAmount = lendAmount;
        this.applyTime = applyTime;
    }

    public String getLendApplyNo() {
        return lendApplyNo;
    }

    public String getUid() {
        return uid;
    }

    public String getBizSerial() {
        return bizSerial;
    }

    public String getParentBizSerial() {
        return parentBizSerial;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public String getBizType() {
        return bizType;
    }

    public String getLendType() {
        return lendType;
    }

    public String getLendCardId() {
        return lendCardId;
    }

    public String getRepayCardId() {
        return repayCardId;
    }

    public String getAssetProductId() {
        return assetProductId;
    }

    public String getAssetBank() {
        return assetBank;
    }

    public Integer getStage() {
        return stage;
    }

    public Integer getLendAmount() {
        return lendAmount;
    }

    public Date getApplyTime() {
        return applyTime;
    }

    public String getApplyStatus() {
        return applyStatus;
    }

    public void setApplyStatus(String applyStatus) {
        this.applyStatus = applyStatus;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public static class Builder {

        private String lendApplyNo;
        private String uid;
        private String bizSerial;
        private String parentBizSerial;
        private String orderNo;
        private String bizType;
        private String lendType;
        private String lendCardId;
        private String repayCardId;
        private String assetProductId;
        private String assetBank;
        private Integer stage;
        private Integer lendAmount;
        private Date applyTime;

        public Builder lendApplyNo(String lendApplyNo) {
            this.lendApplyNo = lendApplyNo;
            return this;
        }

        public Builder uid(String uid) {
            this.uid = uid;
            return this;
        }

        public Builder bizSerial(String bizSerial) {
            this.bizSerial = bizSerial;
            return this;
        }

        public Builder parentBizSerial(String parentBizSerial) {
            this.parentBizSerial = parentBizSerial;
            return this;
        }

        public Builder orderNo(String orderNo) {
            this.orderNo = orderNo;
            return this;
        }

        public Builder bizType(String bizType) {
            this.bizType = bizType;
            return this;
        }

        public Builder lendType(String lendType) {
            this.lendType = lendType;
            return this;
        }

        public Builder lendCardId(String lendCardId) {
            this.lendCardId = lendCardId;
            return this;
        }

        public Builder repayCardId(String repayCardId) {
            this.repayCardId = repayCardId;
            return this;
        }

        public Builder assetProductId(String assetProductId) {
            this.assetProductId = assetProductId;
            return this;
        }

        public Builder assetBank(String assetBank) {
            this.assetBank = assetBank;
            return this;
        }

        public Builder stage(Integer stage) {
            this.stage = stage;
            return this;
        }

        public Builder lendAmount(Integer lendAmount) {
            this.lendAmount = lendAmount;
            return this;
        }

        public Builder applyTime(Date applyTime) {
            this.applyTime = applyTime;
            return this;
        }

        public Order build() {
            return new Order(lendApplyNo, uid, bizSerial, parentBizSerial, orderNo, bizType, lendType, lendCardId, repayCardId, assetProductId, assetBank, stage, lendAmount, applyTime);
        }

    }
}
